<?php

use think\facade\Route;

Route::group('v1', function ()
{
    //登入
    Route::post('/login', 'AuthController/login');
    //需要登入的api
    Route::group('',function ()
    {

        //标签
        Route::get('/tags/:id', 'TagController/getById')->model(\app\model\ShopTag::class);
        Route::post('/tags', 'TagController/create');
        Route::get('/tags', 'TagController/get');
        Route::put('/tags/:id', 'TagController/update')->model(\app\model\ShopTag::class);
        Route::delete('/tags/:id', 'TagController/delete')->model(\app\model\ShopTag::class);

        //分类
        Route::get('/categories/:id', 'CategoryController/getById')->model(\app\model\ShopCategory::class);
        Route::post('/categories', 'CategoryController/create');
        Route::get('/categories', 'CategoryController/get');
        Route::put('/categories/:id', 'CategoryController/update')->model(\app\model\ShopCategory::class);
        Route::delete('/categories/:id', 'CategoryController/delete')->model(\app\model\ShopCategory::class);

        //特殊运费
        Route::get('/freights/specials/:id', 'FreightController/getFreightSpecialById')->model(\app\model\ShopFreightSpecial::class);
        Route::post('/freights/specials/:id', 'FreightController/createFreightSpecial')->model(\app\model\ShopFreight::class);
        Route::put('/freights/specials/:id', 'FreightController/updateFreightSpecia')->model(\app\model\ShopFreightSpecial::class);
        Route::delete('/freights/specials/:id', 'FreightController/deleteFreightSpecia')->model(\app\model\ShopFreightSpecial::class);
        //运费
        Route::post('/freights', 'FreightController/createFreight');
        Route::get('/freights/:id', 'FreightController/getById')->model(\app\model\ShopFreight::class);;
        Route::get('/freights', 'FreightController/get');
        Route::put('/freights/status/:id', 'FreightController/freightBanOrUndo')->model(\app\model\ShopFreight::class);
        Route::put('/freights/:id', 'FreightController/updateFreight')->model(\app\model\ShopFreight::class);
        Route::delete('/freights/:id', 'FreightController/deleteFreight')->model(\app\model\ShopFreight::class);

        //用户
        Route::get('/users/:id', 'UserController/getById')->model(\app\model\ShopUser::class);
        Route::get('/users', 'UserController/get');
        Route::put('/users/tag/:id', 'UserController/updateUserTags')->model(\app\model\ShopUser::class);
        Route::put('/users/status/:id', 'UserController/banOrUndo')->model(\app\model\ShopUser::class);

        //角色认证
        Route::get('/roles', 'RoleController/get');

        //角色等级
        Route::get('/levels', 'LevelController/get');

    })->middleware(\app\middleware\JwtAuth::class);
});

